﻿Shader "LDM/Lit"
{
    Properties
    {
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            // make fog work
            #pragma multi_compile_fog

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float3 normalDir: Normal;
            };

            struct v2f
            {
                float4 vertex : SV_POSITION;
                float3 normalDir: TEXCOORD0;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.normalDir = UnityObjectToWorldNormal(v.normalDir);
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                float3 nDir = i.normalDir;
                float3 lDir = _WorldSpaceLightPos0.xyz;
                float pos = dot(i.normalDir, lDir);
                float lambit = max(0.0, pos);
                return float4(lambit, lambit, lambit, 1.0);
            }
            ENDCG
        }
    }
}
